const path = require('path')
// 导入webpack包，然后去node_modules里面去找webpack
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: './src/main.js',
  output: {
    // __dirname, 'dist'是全局变量
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: ["style-loader", "css-loader"],
      },
      {
        test: /\.less$/i,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
          },
          {
            loader: 'less-loader',
            // options: {
            //   lessOptions: {
            //     strictMath: true,
            //   },
            // },
          },
        ],
      },
      {
        test:/\.vue$/,
        use:['vue-loader']
      }
    ],
  },
  // resove一般用来解决路径问题
  resolve:{
    // 省略扩展名后缀
    extensions:['.js','.css','.vue'],
    // 解决扩展名问题
    alias: {
      'vue$':'vue/dist/vue.esm.js'
    }
  },
  resolves:[
    new webpack.BannerPlugin('最终版权归于张三所有')
  ]
}